define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'jizhan.refund_order/index',
        add_url: 'jizhan.refund_order/add',
        edit_url: 'jizhan.refund_order/edit',
        delete_url: 'jizhan.refund_order/delete',
        export_url: 'jizhan.refund_order/export',
        modify_url: 'jizhan.refund_order/modify',
        detail_url: 'jizhan.refund_order/detail',
        examine_url: 'jizhan.refund_order/refundExamine',
    };
    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    // 订单号|类型,用户昵称|ID|代理等级,商品名称,规格,购买数量,下单基站,下单时间,销售价,优惠金额,实际支付,返利积分,支付方式,订单 状态,完成时间
                    {type: "checkbox"},
                    {field: 'id', minWidth:  50, title: '售后订单ID', search: 'no'},
                    {field: 'order_id', width: 190, title: '订单号', search: true},
                    {field: 'old_order_id', width: 190, title: '原始订单号', search: true},
                    {field: 'userInfo', width: 180, title: '用户信息', search: 'no'},
                    {field: 'productInfo', minWidth: 330, title: '商品信息', search: 'no'},
                    {field: 'payPrice', minWidth: 120, title: '实际支付', search: 'no'},
                    {field: 'add_time', minWidth: 160, title: '发起退款时间', search: 'range'},
                    {field: 'refundStatus', minWidth: 120, title: '退款状态', selectList: refundStatus},
                    {field: 'refund_reason', minWidth: 120, title: '退款信息', search: 'no'},
                    {field: 'remark', minWidth: 120, title: '售后备注', search: 'no'},
                    {
                        width: 250,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '退款详情',
                                url: init.detail_url,
                                method: 'open',
                                auth: 'detail',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                            },{
                                text: '退款审批',
                                url: init.examine_url,
                                method: 'open',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: '',
                            }]
                        ]
                    }
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        detail: function () {
            ea.listen();
        },
        examine: function () {
            ea.listen();
        },
    };
    return Controller;
});